package com.matt.repository.base;

import com.dotflat.fin.domain.PayRecord;
import com.matt.domain.Clientele;
import com.matt.domain.Contract;
import com.matt.foundation.query.ClienteleQuery;
import com.matt.foundation.query.PageableQuery;
import com.matt.foundation.vo.ClienteleListVO;
import com.matt.foundation.vo.ClienteleNameVo;
import com.matt.foundation.vo.ClienteleVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
 * ***********************
 * description: 客户原生的sql
 * Created by Ron
 * from com.matt
 * on 2018/6/19 0019.
 * ************************
 */
public interface ClienteleNativeRepository {

    List<Clientele> findByQuery(ClienteleQuery clienteleQuery);

    Long count(ClienteleQuery clienteleQuery);

    List<Clientele> findChilds(String areaId,String childName);

    List<ClienteleVo> continueClienteles(ClienteleQuery clienteleQuery);

    Long countContinueClienteles(ClienteleQuery clienteleQuery);

    List<Object[]> findClienteleProducts(String clienteleId);

    List<Object[]> findLastPurchaseInfo(String id);

    Page<ClienteleListVO> findByName(String name, String areaId, List<String> clientIds, Pageable pageable);

    Clientele findBySystemChildNameAndId(String id, String sysChildName, String areaId);

    List<Clientele> findByChildNameAndAreaId(String childName, String areaId);

    Long followClienteleNum(String staffId, Date begin,Date end);

    Long viewClienteleNum(String staffId, Date begin,Date end);

    Long increaseClienteleNum(String staffId, Date begin,Date end);

    List<Object[]> findChannelCount(String areaIds,String date);

    List<Contract> findByClienteleIdIn(String clienteleIds);

    Page<PayRecord> childrenIdByPayRecord(List<String> ids, Pageable pageable);
}
